<template>
  <vue-content>
    <div class="allFrom">
      <div class="oldFrom">
        <div class="fromTitle">编辑前</div>
        <el-form :model="oldData" label-width="120px">
          <el-form-item label="企业名称">
            <el-input v-model="oldData.companyName" auto-complete="off" readonly="readonly"></el-input>
          </el-form-item>
          <el-form-item label="企业规模">
            <el-input v-model="oldData.companyScaleName" auto-complete="off" readonly="readonly"></el-input>
          </el-form-item>
          <el-form-item label="企业类型">
            <el-input v-model="oldData.companyType" auto-complete="off" readonly="readonly"></el-input>
          </el-form-item>
          <el-form-item label="企业简介">
            <el-input
            v-model="oldData.companyDesc"
            type="textarea"
            readonly="readonly"
          auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item label="企业联系人">
            <el-input v-model="oldData.contractPerson" auto-complete="off" readonly="readonly"></el-input>
          </el-form-item>
          <el-form-item label="企业联系电话">
            <el-input v-model="oldData.contractPhone" auto-complete="off" readonly="readonly"></el-input>
          </el-form-item>
          <el-form-item label="企业联系邮箱">
            <el-input v-model="oldData.email" auto-complete="off" readonly="readonly"></el-input>
          </el-form-item>
          <el-form-item label="企业地址">
            <el-input v-model="oldData.companyAddress" auto-complete="off" readonly="readonly"></el-input>
          </el-form-item>
          <el-form-item label="企业logo">
            <div class="imgBox" v-if="oldData.companyLogoUrl != ''" >
              <img class="logoImg" :src="imgSrc(oldData.companyLogoUrl)"/>
            </div>
            <div v-if="oldData.companyLogoUrl == ''" class="typeBox">
                无图片
            </div>
          </el-form-item>
        </el-form>
      </div>
      <div class="centerBox">
        <i class="el-icon-arrow-right centerIcon"></i>
      </div>
      <div class="newFrom">
        <div class="fromTitle">编辑后</div>
        <el-form :model="newData" label-width="120px">
          <el-form-item label="企业名称">
            <el-input v-model="newData.companyName" auto-complete="off" readonly="readonly"></el-input>
          </el-form-item>
          <el-form-item label="企业规模">
            <el-input v-model="newData.companyScaleName" auto-complete="off" readonly="readonly"></el-input>
          </el-form-item>
          <el-form-item label="企业类型">
            <el-input v-model="newData.companyType" auto-complete="off" readonly="readonly"></el-input>
          </el-form-item>
          <el-form-item label="企业简介">
            <el-input
            v-model="newData.companyDesc"
            type="textarea"
            readonly="readonly"
          auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item label="企业联系人">
            <el-input v-model="newData.contractPerson" auto-complete="off" readonly="readonly"></el-input>
          </el-form-item>
          <el-form-item label="企业联系电话">
            <el-input v-model="newData.contractPhone" auto-complete="off" readonly="readonly"></el-input>
          </el-form-item>
          <el-form-item label="企业联系邮箱">
            <el-input v-model="newData.email" auto-complete="off" readonly="readonly"></el-input>
          </el-form-item>
          <el-form-item label="企业地址">
            <el-input v-model="newData.companyAddress" auto-complete="off" readonly="readonly"></el-input>
          </el-form-item>
          <el-form-item label="企业logo">
            <div class="imgBox" v-if="newData.companyLogoUrL != ''" >
              <img class="logoImg" :src="imgSrc(newData.companyLogoUrL)"/>
            </div>
            <div v-if="newData.companyLogoUrL == ''" class="typeBox">
                无图片
            </div>
          </el-form-item>
        </el-form>
      </div>
      <div class="applyfooter">
        <el-button style="float:right" type="info" @click="back()">后 退</el-button>
      </div>
    </div>
  </vue-content>
</template>

<script>
  import {checkDetail} from '@/services/applyManager'
  import { getInsFromData} from "@/services/getFromData";
  import {RequestError} from '@/services/errors'
  import {deepClone} from '@/utilities/object'
  export default {
    name: 'account-manager',
    components: {},
    data: () => ({
      imgShow:"",
      Subabled:false,
      dialogImageUrl: '',
      dialogVisible: false,
      oldData: {
      },
      newData: {
			},
      loading: false,
      applyNo:""
    }),
    created () {
      let routerParams = this.$route.query;
      // 将数据放在当前组件的数据内
      this.applyNo = routerParams.applyNo;
      this.loadData(this.applyNo);
    },
    methods: {
      async loadData (applyNo) {
        this.loading = true
        try {
          let data = await checkDetail(applyNo)
          // debugger
          this.oldData = data.companyInfo
          this.newData = data.changeCompanyInfo
        } catch (e) {
          if (e instanceof RequestError) {
            this.$alert(e.message, '提示', {
              type: 'error',
              confirmButtonText: '确定'
            })
          } else {
            throw e
          }
        }
        this.loading = false
      },
      imgSrc(data){
      	return this.$store.state.imgUrl + data;
      },
      back(){
        this.$router.go(-1)
      }
    },
    watch: {
    },
    filters: {
    }
  }
</script>

<style scoped>
.editImg{
	  overflow: hidden;
    background-color: #fff;
    border: 1px solid #c0ccda;
    border-radius: 6px;
    box-sizing: border-box;
    width: 148px;
    height: 148px;
    margin: 0 8px 8px 0;
    display: inline-block;
    float: left;
}
.editImg img{
	width: 100%;
	height: 100%;
}
.allFrom{
  width: 100%;
  overflow: hidden;
}
.oldFrom{
  width: 40%;
  float: left;
}
.newFrom{
  width: 40%;
  float: left;
}
.applyfooter{
  width: 100%;
  float: right;
}
.centerBox{
  width: 12%;
  float: left;
  overflow: hidden;
}
.fromTitle{
  text-align: center;
  font-size: 20px;
  line-height: 60px;
  padding-bottom: 10px;
}
.centerIcon{
  width: 30px;
  font-size: 50px;
  display: block;
  margin: 0 auto;
  line-height: 500px;
  color: #009688;
}
</style>


